<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <div>
            hello
        </div>
    </div>

    <script>
        let data={
            msg:'hello vue'
        }
        let vm={}

        Object.defineProperty(vm,"msg",{
            enumerable:true,
            configurable:true,
            get() {
                console.log('get:',data.msg)
                return data.msg
            },
            set(newValue) {
                console.log("newValue:",newValue)
                if (newValue ===data.msg){
                    return
                }
                data.msg=newValue
                document.querySelector("#app").textContent=data.msg
            }
        })

        //测试
        vm.msg='hhhhhhhh'
        console.log(vm.msg)

    </script>


</body>
</html>